package com.mymall.serve.exception;

import com.mymall.serve.enums.ResultCodeEnum;

/**
 * 业务异常类
 *
 * @author weiwei
 * @since 2020-04-12 13:25
 **/
public class BusException extends RuntimeException{
    private int code;

    public BusException(){
        this.code = ResultCodeEnum.ERROR.getCode();
    }

    public BusException(String message){
        super(message);
        this.code = ResultCodeEnum.ERROR.getCode();
    }

    public BusException(int code,String message){
        super(message);
        this.code = code;
    }

    public BusException(ResultCodeEnum enumObj){
        super(enumObj.getMsg());
        this.code = enumObj.getCode();
    }

    public BusException(String message,Throwable cause){
        super(message,cause);
        this.code = ResultCodeEnum.ERROR.getCode();
    }

    public BusException(Throwable cause){
        super(cause);
        this.code = ResultCodeEnum.ERROR.getCode();
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

}
